import pandas as pd
from Crypto.Cipher import AES


def decrypt(ciphertext, key):

    iv = ciphertext[:AES.block_size]
    cipher = AES.new(key, AES.MODE_CBC, iv)
    plaintext = cipher.decrypt(ciphertext[AES.block_size:])
    return plaintext.rstrip(b"\0")
    

def decryption(name,key):
    with open(name,'rb') as f:
        enc = f.read()
    b = decrypt(enc,key)
    df = pd.read_json(b,orient='index')
    return df
    

    
